import * as API from '../utils/api'

export const LOAD_DEMAND_LIST = 'LOAD_DEMAND_LIST'
export const UPDATE_DEMAND_LIST = 'UPDATE_DEMAND_LIST'

export const loadDemandList = function (body) {
    return async function (dispatch)  {
        const list = await API.fetchDemandList(body)
        dispatch(updateDemandList({
            ...list
        }))
    }
}
export const updateDemandList = list => ({type: UPDATE_DEMAND_LIST, list})